package com.cskt.service.impl;

import com.cskt.service.MailService;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class MailServiceImpl implements MailService {

    @Resource
    private MailSender mailSender;

    @Override
    public void sendActivationMail(String mailTo, String activaCode) {
        SimpleMailMessage mailMessage = new SimpleMailMessage();
        //指定需要发送的地址
        mailMessage.setTo(mailTo);
        //指定需要发送的内容
        mailMessage.setText(activaCode);
        //执行发送
        mailSender.send(mailMessage);
    }
}
